<template>
  <div class="box">
    <ul class="main">
      <li class="item">
        <div class="item-switch-box">
          <span class="item-switch-title">转接备注</span>
          <el-switch v-model="openRemark" />
        </div>
        <p class="item-des">开启后，员工转接会话时，必须填写备注</p>
      </li>
      <li class="item">
        <div class="item-switch-box">
          <span class="item-switch-title">转接确认</span>
          <el-switch v-model="openConfirm" />
        </div>
        <p class="item-des">开启后，被转接座席将收到请求弹窗，可接受或拒绝;转接至技能组将不考虑会话排队情况</p>
      </li>
      <!-- <li class="item">
        <div class="item-switch-box">
          <span class="item-switch-title">转接后不排队</span>
          <el-switch v-model="openNoQueueUp" />
        </div>
        <p class="item-des">
          开启后，被转接会话转接至座席时，不考虑座席接待上限；被转接会话转接至技能组时，不考虑技能组排队情况，随机分配
        </p>
      </li> -->
    </ul>
    <el-button size="mini" class="btn" type="primary" @click="onSave">保存</el-button>
  </div>
</template>
<script>
export default {
  name: 'transferConfig',
  data() {
    return {
      openRemark: false,
      openConfirm: false,
      // openNoQueueUp: false
    }
  },
  async mounted() {
    await this.getConfig()
  },
  methods: {
    async onSave() {
      const data = {
        type:"redirectWebchatSessionCofing",
        redirectWebchatSessionCommentFlag: this.openRemark,
        redirectWebchatSessionConfirmFlag: this.openConfirm,
        // redirectWebchatSessionNotQueueFlag: this.openNoQueueUp
      }
      await this.$store.dispatch('saveRedirectDic', data)
      this.$message.success('保存成功')
    },
    async getConfig() {
      const res = await this.$store.dispatch('getDicByType', { type: 'redirectWebchatSessionCofing' })
      const { 
        redirectWebchatSessionCommentFlag, 
        redirectWebchatSessionConfirmFlag, 
        // redirectWebchatSessionNotQueueFlag 
      } = res.row || {}
      this.openRemark = redirectWebchatSessionCommentFlag
      this.openConfirm = redirectWebchatSessionConfirmFlag
      // this.openNoQueueUp = redirectWebchatSessionNotQueueFlag
    }
  }
}
</script>
<style lang="stylus" scoped>
.box
  padding 20px
.item
  margin-top 20px
.item-switch-title
  font-size 12px
  font-weight 500
  margin-right 10px
.item-des
  color #aaaaaa
  margin-top 10px
  font-size 12px
.btn
  margin-top 20px
</style>
